package com.mall.controller;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.common.domain.PageDTO;
import com.mall.domain.dto.ItemDTO;
import com.mall.domain.po.Item;
import com.mall.domain.query.ItemPageQuery;
import com.mall.service.ItemService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/search")
@RequiredArgsConstructor
public class SearchController {

    private final ItemService itemService;

    /**
     * 分页查询
     * @param query
     * @return
     */
    @GetMapping("/list")
    public PageDTO<ItemDTO> search(ItemPageQuery query){
        return itemService.search(query);
    }
}
